home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / mgr / sparcmgr / demo2.zoo / demo / ex / makeoptions < prev    next >
Encoding:
Text File  |  1989-08-31  |  1.2 KB  |  55 lines

  1. #
  2. # Copyright (c) 1980 Regents of the University of California.
  3. # All rights reserved.  The Berkeley software License Agreement
  4. # specifies the terms and conditions for redistribution.
  5. #
  6. #    @(#)makeoptions    6.4 (Berkeley) 5/31/85
  7. #
  8.  
  9. #
  10. # remake options -- this isn't necessary unless you add/delete options
  11. #
  12. onintr ifintr
  13. cat < ex_data.c > /tmp/$$.c
  14. ex - /tmp/$$.c <<'%'
  15.     g/^#include/d
  16.     w
  17.     q
  18. '%'
  19. cc -E $* /tmp/$$.c >/tmp/foo.c
  20. ex - /tmp/foo.c <<'X'
  21.     " delete all preprocessor output (# line, etc)
  22.     g/^# /d
  23.     set sh=/bin/csh
  24.     " delete junk (all but data lines)
  25.     g/^[     ]*$/d
  26.     1,/option options/d
  27.     /}/-1,$d
  28.     " get rid of all of line but option name
  29.     1,$s/[     ]*"//
  30.     1,$s/".*//
  31.     " begin kludge since options start at 0 but cat -n starts at 1
  32.     "              move first to end and later move it back and renumber
  33.     1m$
  34.     %!cat -n
  35.     $t0
  36.     1s/[0-9][0-9]*/0/
  37.     " end kludge
  38.     " make #define lines
  39.     1,$s/[     ]*\([0-9][0-9]*\)[     ]*\(.*\)/#define    \U\2\L    \1/
  40.     " filter through expand to make it line up nice
  41.     %!/usr/ucb/expand -8\,24
  42.     " blank line and number of options.
  43.     $i
  44.  
  45. .
  46.     $s/e[     ].*[     ]/e    NOPTS    /
  47.     0a
  48.     /*  sccs id   @(#)  ex_vars.h  @(#)makeoptions    6.4 5/31/85  */
  49. .
  50.     w! ex_vars.h
  51.     q
  52. 'X'
  53. ifintr:
  54. rm /tmp/foo.c
  55.